A Parallel Tree Di erence Algorithm
نویسنده
چکیده
We present a tree di erence algorithm with expected sequential execution timeO(n log log n) and expected parallel execution time of O(log n), for trees of size n. The algorithm assumes unique labels and permits operations only on leaves and frontier subtrees. Despite these limitations, it can be useful in the analysis of structured text. 1 Applications of Tree Di erence In this paper we describe an algorithm for determining the di erence between two trees under the assumption that each node has a unique label chosen from an ordered set. The algorithm uses a novel form of hashing to quickly extract neighbourhood information for each node. In a second phase, this neighbourhood information is processed to determine what di erences exist between the trees. We assume that trees may be arbitrarily branching, and that the following operations may have been applied to them: 1. a node was inserted to become a new leaf; 2. a leaf node was deleted; 3. a leaf node was moved to become a leaf node in another part of the tree; 4. a subtree was inserted below any node; 5. a subtree was deleted; 6. a subtree was moved to another part of the tree In reporting di erences, preference is given to subtree operations since they provide more compact and meaningful descriptions of changes, for example, \a section has moved" rather than \each paragraph of a section has moved". The algorithm could be enhanced at the processing stage to detect other possible tree operations, at the expense of execution time. The tree di erence algorithm for trees with n nodes has expected sequential time complexity O(n log log n) and parallel time complexity O(log n) on the EREW PRAM model. Other tree operations have been considered in the literature. For example, there is a sequence of algorithms based on insertions and deletions where an insertion below a node x allows the new node to acquire some of x 's children as its children, and hence x 's grandchildren. A symmetric deletion moves the children of a deleted node up to become the children of the parent of the deleted node [8]. The assumption that each tree node has a unique label is probably not supportable for today's techniques for storing such trees. However, attributed le systems such as DFR [6] require such identi ers for each node in the le system, so we expect this assumption to quickly become realistic. In any case, non-unique labels force di erence algorithms to carry out some variation of dynamic programming, for which time bounds are necessarily much worse.
منابع مشابه
Orr Sommerfeld Solver Using Mapped Finite Di?erence Scheme for Plane Wake Flow
Linear stability analysis of the three dimensional plane wake flow is performed using a mapped finite di?erence scheme in a domain which is doubly infinite in the cross–stream direction of wake flow. The physical domain in cross–stream direction is mapped to the computational domain using a cotangent mapping of the form y = ?cot(??). The Squire transformation [2], proposed by Squire, is also us...
متن کاملFast Load Balancing in Cayley Graphs
We compare two load balancing techniques for Cayley graphs based on information and load exchange between neighboring vertices. In the rst scheme, called natural di usion, each vertex gives (or receives) a xed part of the load di erence to (from) its direct neighbors. In the second scheme, called Cayley di usion, each vertex successively gives (or receives) a part of the load di erence to (or f...
متن کاملSystem Reduction and Solution Algorithms for Singular Linear Di¤erence Systems Under Rational Expectations
A rst-order linear di¤erence system under rational expectations is, AEyt+1jIt = Byt +C(F)ExtjIt; where yt is a vector of endogenous variables; xt is a vector of exogenous variables; Eyt+1jIt is the expectation of yt+1 given date t information; and C(F)ExtjIt = C0xt+ C1Ext+1jIt + ::: + CnExt+njIt. Many economic models can be written in this form, especially if the matrix A is permitted to be si...
متن کاملParallel Generation of t-ary Trees
A parallel algorithm for generating t-ary tree sequences in reverse B-order is presented. The algorithm generates t-ary trees by 0-1 sequences, and each 0-1 sequences is generated in constant average time O(1). The algorithm is executed on a CREW SM SIMD model, and is adaptive and cost-optimal. Prior to the discussion of the parallel algorithm a new sequential generation with O(1) average time ...
متن کاملOn the Complexity of Recognizing Iterated Differences of Polyhedra on the Complexity of Recognizing Iterated Differences of Polyhedra
The iterated di erence of polyhedra V P n P n Pk has been proposed independently in and as a su cient condition for V to be exactly computable by a two layered neural network An algorithm checking whether V IR is an iterated di erence of polyhedra is proposed in However this algorithm is not practically usable because it has a high computational complexity and it was only conjectured to stop wi...
متن کامل